package it.asvp.asvp_portal.data.entity.domain;


import static javax.persistence.GenerationType.IDENTITY;
import it.asvp.asvp_portal.asvp_util.enumerative.LinkType;
import it.asvp.asvp_portal.data.entity.member.Member;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@SuppressWarnings("serial")
@Entity
@Table(name = "link", catalog = "asvp_db")
public class Link extends BaseEntity {

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	private Long id;
	
	@Column(name = "link_type", nullable = false, length = 50)
	@Enumerated(EnumType.STRING)
	private LinkType linkType;
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_member", nullable = false)
	private Member member;
	
	@Column(name = "name", nullable = false, length = 100)
	private String name;
	
	@Column(name = "url", nullable = false)
	private String url;

	public Link() {
	}

	public Link(LinkType linkType, Member member, String name, String url,
			Date createdOn, Date lastUpdate) {
		this.linkType = linkType;
		this.member = member;
		this.name = name;
		this.url = url;
		this.createdOn = createdOn;
		this.lastUpdate = lastUpdate;
	}

	
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}


	public LinkType getLinkType() {
		return this.linkType;
	}

	public void setLinkType(LinkType linkType) {
		this.linkType = linkType;
	}

	
	public Member getMember() {
		return this.member;
	}

	public void setMember(Member member) {
		this.member = member;
	}

	
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}


	public String getUrl() {
		return this.url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

}
